package com.jindy.module.AssetDetails.service.impl;

import java.util.List;
import com.jindy.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.jindy.module.AssetDetails.mapper.AssetDetailsMapper;
import com.jindy.module.AssetDetails.domain.AssetDetails;
import com.jindy.module.AssetDetails.service.IAssetDetailsService;

/**
 * 资产明细Service业务层处理
 * 
 * @author jindy
 * @date 2023-04-19
 */
@Service
public class AssetDetailsServiceImpl implements IAssetDetailsService 
{
    @Autowired
    private AssetDetailsMapper assetDetailsMapper;

    /**
     * 查询资产明细
     * 
     * @param id 资产明细主键
     * @return 资产明细
     */
    @Override
    public AssetDetails selectAssetDetailsById(Long id)
    {
        return assetDetailsMapper.selectAssetDetailsById(id);
    }

    /**
     * 查询资产明细列表
     * 
     * @param assetDetails 资产明细
     * @return 资产明细
     */
    @Override
    public List<AssetDetails> selectAssetDetailsList(AssetDetails assetDetails)
    {
        return assetDetailsMapper.selectAssetDetailsList(assetDetails);
    }

    /**
     * 新增资产明细
     * 
     * @param assetDetails 资产明细
     * @return 结果
     */
    @Override
    public int insertAssetDetails(AssetDetails assetDetails)
    {
        assetDetails.setAssetAvailQuantity(assetDetails.getAssetQuantity());
        assetDetails.setCreateTime(DateUtils.getNowDate());
        return assetDetailsMapper.insertAssetDetails(assetDetails);
    }

    /**
     * 修改资产明细
     * 
     * @param assetDetails 资产明细
     * @return 结果
     */
    @Override
    public int updateAssetDetails(AssetDetails assetDetails)
    {
        assetDetails.setUpdateTime(DateUtils.getNowDate());
        return assetDetailsMapper.updateAssetDetails(assetDetails);
    }

    /**
     * 批量删除资产明细
     * 
     * @param ids 需要删除的资产明细主键
     * @return 结果
     */
    @Override
    public int deleteAssetDetailsByIds(Long[] ids)
    {
        return assetDetailsMapper.deleteAssetDetailsByIds(ids);
    }

    /**
     * 删除资产明细信息
     * 
     * @param id 资产明细主键
     * @return 结果
     */
    @Override
    public int deleteAssetDetailsById(Long id)
    {
        return assetDetailsMapper.deleteAssetDetailsById(id);
    }

}
